<?php

use yii\bootstrap\ActiveForm;
use kartik\editable\Editable;
?>
<!-- 审核界面 -->
<div class="text-center">
<hr>
<?php
	if($model->type == 1 || $model->type == 2){ //	收款
		if($role == "财务"){
			//if($invoice->status == 1 && $model->status == 3){ // 提交审核
			if($invoice->status == 1){ 
?>
				<?php $form = ActiveForm::begin(['action' => '/finance/invoice/check-status','method'=>'post']); ?>
					<input type="hidden" name="id" value="<?= $invoice->id ?>" >
					<?= \yii\helpers\Html::radioList("status", 3, [3=>'通过', 5=>'拒绝'], []) ?>
					<button type="submit" class="btn btn-warning">财务审核</button>
				<?php ActiveForm::end(); ?>
<?php
			}else{
				echo sprintf("<div class='text-center'><h3 >%s</h3></div>", Yii::$app->params['invoice_status'][$invoice->status] );
			}
		}
	}
?>


<?php if($invoice->status == 3 && $role == "财务"){ ?>
		<div class="alert alert-danger" role="alert" >发票单号 : <?=  Editable::widget([
			'name' => 'Invoice[code]',
			'value' => $invoice->code,
			'asPopover' => false,
			'header' => '',
			'size'=>'md',
			'formOptions' => ['action'=>'/finance/invoice/edit?id='.$invoice->id, 'method'=>'get','id'=>'editFrom'.$invoice->id],
			'options' => ['class'=>'form-control', 'placeholder'=> Yii::t('app.finance', '发票单号')],
			'pluginEvents'=> [ ],
		])
		?></div>
	<?php }else if($role != "财务"){ ?>
		<div class="alert alert-success" role="alert" >发票单号 : <?=$invoice->code?></div>
	<?php }?>

</div>